<?php
class notesController extends appController {
    public function detail($id){
        if(empty($id)){
            return $this->unknownAction();
        }
        
        $data = $this->_model->read($id);
        $this->view->set('item',$data[0]);
        return $this->view();       

    }

    public function upload(){
        return $this->view();
    }
public function notes($id=null, $name=null, $title=null, $descp=null,$point_num=null,$files=null){

            if($_SERVER["REQUEST_METHOD"]=='POST'){
                // print_r($files);exit;
            $uploads_dir = 'notes/';
            $files =$_FILES['files']['name'];
            $image_tmp =$_FILES['files']['tmp_name'];
            move_uploaded_file($image_tmp,"$uploads_dir/$files");
            $id = $this->_model->notesfeilds($id,$name,$title,$descp,$point_num,$files);
            
            if($id !== false){
                header('Location: notes');
                exit;
            }
        
        }
            
            return $this->view();
    }
}
?> 